#!/usr/bin/env python
# -*- coding: utf-8 -*-
#coding=utf8
# 协议模块定义文件

from ptl.base_csbuf import *
from ptl.msg3000_csbuf import *
from ptl.msg9000_csbuf import *
from ptl.msg8000_csbuf import *
from ptl.msg7000_csbuf import *
from ptl.msg6000_csbuf import *
from ptl.msg5000_csbuf import *
from ptl.msg4000_csbuf import *
from ptl.msg22000_csbuf import *
from ptl.msg21000_csbuf import *
from ptl.msg20000_csbuf import *
from ptl.msg2000_csbuf import *
from ptl.msg19000_csbuf import *
from ptl.msg18000_csbuf import *
from ptl.msg17000_csbuf import *
from ptl.msg16000_csbuf import *
from ptl.msg15000_csbuf import *
from ptl.msg14000_csbuf import *
from ptl.msg13000_csbuf import *
from ptl.msg12000_csbuf import *
from ptl.msg11000_csbuf import *
from ptl.msg1100_csbuf import *
from ptl.msg10000_csbuf import *
from ptl.msg1000_csbuf import *

_protocols = [{}, {}, {}, {}];

_protocols[1][18001] = Req18001
_protocols[2][18001] = Resp18001
_protocols[1][18002] = Req18002
_protocols[2][18002] = Resp18002
_protocols[1][18010] = Req18010
_protocols[2][18010] = Resp18010
_protocols[1][18011] = Req18011
_protocols[2][18011] = Resp18011
_protocols[1][18020] = Req18020
_protocols[2][18020] = Resp18020
_protocols[1][18021] = Req18021
_protocols[2][18021] = Resp18021
_protocols[1][18025] = Req18025
_protocols[2][18025] = Resp18025
_protocols[1][18026] = Req18026
_protocols[2][18026] = Resp18026
_protocols[1][9001] = Req9001
_protocols[2][9001] = Resp9001
_protocols[1][9002] = Req9002
_protocols[2][9002] = Resp9002
_protocols[1][9003] = Req9003
_protocols[2][9003] = Resp9003
_protocols[1][12001] = Req12001
_protocols[2][12001] = Resp12001
_protocols[1][12002] = Req12002
_protocols[2][12002] = Resp12002
_protocols[1][12003] = Req12003
_protocols[2][12003] = Resp12003
_protocols[1][12004] = Req12004
_protocols[2][12004] = Resp12004
_protocols[1][20001] = Req20001
_protocols[2][20001] = Resp20001
_protocols[1][20002] = Req20002
_protocols[2][20002] = Resp20002
_protocols[1][7001] = Req7001
_protocols[2][7001] = Resp7001
_protocols[1][7002] = Req7002
_protocols[2][7002] = Resp7002
_protocols[1][7003] = Req7003
_protocols[2][7003] = Resp7003
_protocols[1][14001] = Req14001
_protocols[2][14001] = Resp14001
_protocols[1][14002] = Req14002
_protocols[2][14002] = Resp14002
_protocols[1][14003] = Req14003
_protocols[2][14003] = Resp14003
_protocols[1][14004] = Req14004
_protocols[2][14004] = Resp14004
_protocols[1][14005] = Req14005
_protocols[2][14005] = Resp14005
_protocols[1][14006] = Req14006
_protocols[2][14006] = Resp14006
_protocols[1][14007] = Req14007
_protocols[2][14007] = Resp14007
_protocols[1][14010] = Req14010
_protocols[2][14010] = Resp14010
_protocols[1][14011] = Req14011
_protocols[2][14011] = Resp14011
_protocols[1][14012] = Req14012
_protocols[2][14012] = Resp14012
_protocols[1][14013] = Req14013
_protocols[2][14013] = Resp14013
_protocols[1][14014] = Req14014
_protocols[2][14014] = Resp14014
_protocols[1][14015] = Req14015
_protocols[2][14015] = Resp14015
_protocols[1][14020] = Req14020
_protocols[2][14020] = Resp14020
_protocols[1][14021] = Req14021
_protocols[2][14021] = Resp14021
_protocols[1][22001] = Req22001
_protocols[2][22001] = Resp22001
_protocols[1][22002] = Req22002
_protocols[2][22002] = Resp22002
_protocols[1][8001] = Req8001
_protocols[2][8001] = Resp8001
_protocols[1][8002] = Req8002
_protocols[2][8002] = Resp8002
_protocols[1][17001] = Req17001
_protocols[2][17001] = Resp17001
_protocols[1][17002] = Req17002
_protocols[2][17002] = Resp17002
_protocols[1][17003] = Req17003
_protocols[2][17003] = Resp17003
_protocols[0][1] = Err
_protocols[1][3] = Ping
_protocols[2][3] = Pong
_protocols[2][4] = Resp4
_protocols[1][5] = Req5
_protocols[2][5] = Resp5
_protocols[1][13001] = Req13001
_protocols[2][13001] = Resp13001
_protocols[1][13002] = Req13002
_protocols[2][13002] = Resp13002
_protocols[1][13003] = Req13003
_protocols[2][13003] = Resp13003
_protocols[1][13004] = Req13004
_protocols[2][13004] = Resp13004
_protocols[1][13005] = Req13005
_protocols[2][13005] = Resp13005
_protocols[1][5001] = Req5001
_protocols[2][5001] = Resp5001
_protocols[1][5002] = Req5002
_protocols[2][5002] = Resp5002
_protocols[1][5003] = Req5003
_protocols[2][5003] = Resp5003
_protocols[0][4008] = HostAddr
_protocols[1][4001] = Req4001
_protocols[2][4001] = Resp4001
_protocols[1][4002] = Req4002
_protocols[2][4002] = Resp4002
_protocols[1][4011] = Req4011
_protocols[2][4011] = Resp4011
_protocols[1][4013] = Req4013
_protocols[2][4013] = Resp4013
_protocols[1][4014] = Req4014
_protocols[2][4014] = Resp4014
_protocols[1][4010] = Req4010
_protocols[2][4010] = Resp4010
_protocols[1][4003] = Req4003
_protocols[2][4003] = Resp4003
_protocols[1][4004] = Req4004
_protocols[2][4004] = Resp4004
_protocols[1][4005] = Req4005
_protocols[2][4005] = Resp4005
_protocols[2][4006] = Resp4006
_protocols[1][4007] = Req4007
_protocols[2][4007] = Resp4007
_protocols[1][4012] = Req4012
_protocols[2][4012] = Resp4012
_protocols[1][4015] = Req4015
_protocols[2][4015] = Resp4015
_protocols[1][4016] = Req4016
_protocols[2][4016] = Resp4016
_protocols[1][4017] = Req4017
_protocols[2][4017] = Resp4017
_protocols[1][4018] = Req4018
_protocols[2][4018] = Resp4018
_protocols[2][4019] = Resp4019
_protocols[1][4020] = Req4020
_protocols[2][4020] = Resp4020
_protocols[1][6001] = Req6001
_protocols[2][6001] = Resp6001
_protocols[1][6002] = Req6002
_protocols[2][6002] = Resp6002
_protocols[1][6003] = Req6003
_protocols[2][6003] = Resp6003
_protocols[1][6004] = Req6004
_protocols[2][6004] = Resp6004
_protocols[2][6005] = Resp6005
_protocols[1][6006] = Req6006
_protocols[2][6006] = Resp6006
_protocols[1][21001] = Req21001
_protocols[2][21001] = Resp21001
_protocols[1][21003] = Req21003
_protocols[2][21003] = Resp21003
_protocols[1][21005] = Req21005
_protocols[2][21005] = Resp21005
_protocols[1][21006] = Req21006
_protocols[2][21006] = Resp21006
_protocols[1][21010] = Req21010
_protocols[2][21010] = Resp21010
_protocols[1][21011] = Req21011
_protocols[2][21011] = Resp21011
_protocols[1][21012] = Req21012
_protocols[2][21012] = Resp21012
_protocols[2][2010] = Resp2010
_protocols[2][2020] = Resp2020
_protocols[2][2030] = Resp2030
_protocols[2][2040] = Resp2040
_protocols[2][2050] = Resp2050
_protocols[2][2060] = Resp2060
_protocols[2][2080] = Resp2080
_protocols[2][2090] = Resp2090
_protocols[1][2091] = Req2091
_protocols[2][2091] = Resp2091
_protocols[1][2092] = Req2092
_protocols[2][2092] = Resp2092
_protocols[1][2093] = Req2093
_protocols[2][2093] = Resp2093
_protocols[1][2094] = Req2094
_protocols[2][2094] = Resp2094
_protocols[1][2095] = Req2095
_protocols[2][2095] = Resp2095
_protocols[1][2096] = Req2096
_protocols[2][2096] = Resp2096
_protocols[1][2098] = Req2098
_protocols[2][2098] = Resp2098
_protocols[1][2100] = Req2100
_protocols[2][2100] = Resp2100
_protocols[1][2101] = Req2101
_protocols[2][2101] = Resp2101
_protocols[1][2102] = Req2102
_protocols[2][2102] = Resp2102
_protocols[1][2103] = Req2103
_protocols[2][2103] = Resp2103
_protocols[2][16001] = Resp16001
_protocols[1][16002] = Req16002
_protocols[2][16002] = Resp16002
_protocols[1][19001] = Req19001
_protocols[2][19001] = Resp19001
_protocols[1][19002] = Req19002
_protocols[2][19002] = Resp19002
_protocols[1][19003] = Req19003
_protocols[2][19003] = Resp19003
_protocols[1][19004] = Req19004
_protocols[2][19004] = Resp19004
_protocols[2][19005] = Resp19005
_protocols[1][19006] = Req19006
_protocols[2][19006] = Resp19006
_protocols[1][19007] = Req19007
_protocols[2][19007] = Resp19007
_protocols[1][19008] = Req19008
_protocols[2][19008] = Resp19008
_protocols[1][19009] = Req19009
_protocols[2][19009] = Resp19009
_protocols[1][19010] = Req19010
_protocols[2][19010] = Resp19010
_protocols[1][19011] = Req19011
_protocols[2][19011] = Resp19011
_protocols[1][19012] = Req19012
_protocols[2][19012] = Resp19012
_protocols[1][19013] = Req19013
_protocols[2][19013] = Resp19013
_protocols[1][19014] = Req19014
_protocols[2][19014] = Resp19014
_protocols[2][19015] = Resp19015
_protocols[1][19016] = Req19016
_protocols[2][19016] = Resp19016
_protocols[2][19017] = Resp19017
_protocols[1][19018] = Req19018
_protocols[2][19018] = Resp19018
_protocols[1][19019] = Req19019
_protocols[2][19019] = Resp19019
_protocols[1][19020] = Req19020
_protocols[2][19020] = Resp19020
_protocols[1][19021] = Req19021
_protocols[2][19021] = Resp19021
_protocols[1][19022] = Req19022
_protocols[2][19022] = Resp19022
_protocols[1][19030] = Req19030
_protocols[2][19030] = Resp19030
_protocols[1][19031] = Req19031
_protocols[2][19031] = Resp19031
_protocols[1][19032] = Req19032
_protocols[2][19032] = Resq19032
_protocols[1][19033] = Req19033
_protocols[2][19033] = Resp19033
_protocols[1][19034] = Req19034
_protocols[2][19034] = Resp19034
_protocols[1][19040] = Req19040
_protocols[2][19040] = Resp19040
_protocols[1][19050] = Req19050
_protocols[2][19050] = Resp19050
_protocols[1][19051] = Req19051
_protocols[2][19051] = Resp19051
_protocols[1][19052] = Req19052
_protocols[2][19052] = Resp19052
_protocols[1][19053] = Req19053
_protocols[2][19053] = Resp19053
_protocols[1][1101] = Req1101
_protocols[2][1101] = Resp1101
_protocols[2][1102] = Resp1102
_protocols[2][1103] = Resp1103
_protocols[2][1104] = Resp1104
_protocols[1][1105] = Req1105
_protocols[2][1105] = Resp1105
_protocols[1][1106] = Req1106
_protocols[2][1106] = Resp1106
_protocols[1][1107] = Req1107
_protocols[2][1107] = Resp1107
_protocols[1][1108] = Req1108
_protocols[2][1108] = Resp1108
_protocols[1][1109] = Req1109
_protocols[2][1109] = Resp1109
_protocols[1][11001] = Req11001
_protocols[2][11001] = Resp11001
_protocols[2][11002] = Resp11002
_protocols[0][3000] = RespBattleTeams
_protocols[1][3001] = Req3001
_protocols[1][3002] = Req3002
_protocols[2][3002] = Resp3002
_protocols[1][3003] = Req3003
_protocols[2][3003] = Resp3003
_protocols[1][3005] = Req3005
_protocols[2][3005] = Resp3005
_protocols[1][3006] = Req3006
_protocols[2][3006] = Resp3006
_protocols[1][3007] = Req3007
_protocols[2][3007] = Resp3007
_protocols[2][3008] = Resp3008
_protocols[0][3251] = SkillBuffObj
_protocols[1][3009] = Req3009
_protocols[2][3009] = Resp3009
_protocols[1][3010] = Req3010
_protocols[2][3010] = Resp3010
_protocols[1][3011] = Req3011
_protocols[2][3011] = Resp3011
_protocols[1][3012] = Req3012
_protocols[2][3012] = Resp3012
_protocols[1][3013] = Req3013
_protocols[2][3013] = Resp3013
_protocols[1][3014] = Req3014
_protocols[2][3014] = Resp3014
_protocols[1][3015] = Req3015
_protocols[2][3015] = Resp3015
_protocols[1][3016] = Req3016
_protocols[2][3016] = Resp3016
_protocols[2][3017] = Resp3017
_protocols[1][3100] = Req3100
_protocols[2][3100] = Resp3100
_protocols[1][3101] = Req3101
_protocols[2][3101] = Resp3101
_protocols[2][3102] = Resp3102
_protocols[1][3103] = Req3103
_protocols[2][3103] = Resp3103
_protocols[2][3250] = Resp3250
_protocols[2][3201] = Resp3201
_protocols[2][3203] = Resp3203
_protocols[2][3202] = Resp3202
_protocols[2][3211] = Resp3211
_protocols[2][3212] = Resp3212
_protocols[1][3300] = Req3300
_protocols[2][3300] = Resp3300
_protocols[0][3310] = BattleReport
_protocols[1][10001] = Req10001
_protocols[2][10001] = Resp10001
_protocols[1][10002] = Req10002
_protocols[2][10002] = Resp10002
_protocols[1][10003] = Req10003
_protocols[2][10003] = Resp10003
_protocols[1][10004] = Req10004
_protocols[2][10004] = Resp10004
_protocols[1][10005] = Req10005
_protocols[2][10005] = Resp10005
_protocols[1][10006] = Req10006
_protocols[2][10006] = Resp10006
_protocols[1][10007] = Req10007
_protocols[2][10007] = Resp10007
_protocols[1][10008] = Req10008
_protocols[2][10008] = Resp10008
_protocols[1][15001] = Req15001
_protocols[2][15001] = Resp15001
_protocols[1][15002] = Req15002
_protocols[2][15002] = Resp15002
_protocols[1][15003] = Req15003
_protocols[2][15003] = Resp15003
_protocols[1][15004] = Req15004
_protocols[2][15004] = Resp15004

def getProtocol(protoId, groupNumber):
	if groupNumber != None and groupNumber > 0:
		ret = _protocols[groupNumber].get(protoId)
		if ret != None:
			return ret
		
	return _protocols[0].get(protoId)

def protoDict(proto):
	d = {}
	for k, v in proto.__dict__.items():
		if isinstance(v, (int, str, float)):
			d[k] = v
		elif isinstance(v, list):
			d[k] = []
			for p in v:
				if isinstance(v, (int, str, float)):
					d[k].append(p)
				else:
					d[k].append(protoDict(p))
		else:
			d[k] = protoDict(v)
	return d
